package com.atguigu.product.controller;

import com.atguigu.product.Product;
import com.atguigu.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class ProductController {

    @Autowired
    ProductService productService;

    @GetMapping("/product/{productId}")
    public Product getProduct(@PathVariable Long productId){
        System.out.println("正在允许");
        Product product=productService.getProductById(productId);
        return product;
    }
}
